import 'package:canteen/page/add_order_page.dart';
import 'package:flutter/material.dart';
import 'package:canteen/history_c_v.dart';
class ChoosePRPage extends StatefulWidget {
  const ChoosePRPage({super.key});
  static String id='choose_PR_page';

  @override
  State<ChoosePRPage> createState() => _ChoosePRPageState();
}

class _ChoosePRPageState extends State<ChoosePRPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xfffbfbfb),
      appBar: AppBar(
        backgroundColor: Color(0xffffffff).withOpacity(0.89),
        elevation: 0,
        centerTitle: true,
        title: Text(
          '包房',
          style: TextStyle(color: Colors.black, fontSize: 16),
        ),
        leading: GestureDetector(
          onTap: () {
            Navigator.pop(context);
          },
          child: Icon(
            Icons.arrow_back_rounded,
            color: Colors.black,
          ),
        ),
      ),
      body: Container(
        padding: EdgeInsets.all(15),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(25)),
        child: GridView.builder(
          itemCount: privateRooms.length,
          itemBuilder: (context, index) {
            return GestureDetector(
              onTap: (){
                selectedValuePR=privateRooms[index];
                Navigator.pushNamed(context, AddOrderPage.id);
              },
              child: Stack(
                children: [
                  Container(
                    alignment: Alignment.center,
                    padding: EdgeInsets.symmetric(
                        horizontal: 10, vertical: 8),
                    decoration: BoxDecoration(
                        boxShadow: [
                          BoxShadow(
                              offset: Offset(0, 1),
                              blurRadius: 2,
                              color: Colors.black
                                  .withOpacity(0.25))
                        ],
                        color: Colors.white,
                        borderRadius:
                        BorderRadius.circular(15)),
                    child: Text(
                      privateRooms[index],
                      style: TextStyle(fontSize: 16),
                    ),
                  ),
                  Positioned(
                    left: 8,
                    top: 8,
                    child: Container(
                      height: 12,
                      width: 12,
                      decoration: BoxDecoration(
                        shape: BoxShape.circle,
                        border: Border.all(
                            color: Colors.black
                                .withOpacity(0.6),
                            width: 0.5),
                      ),
                    ),
                  ),
                ],
              ),
            );
            //   DishWidget(
            //   dishName: setMeal.dishes.keys
            //       .map((e) => e.name)
            //       .toList()[index],
            //   childWidget: Text(
            //       '×${setMeal.dishes.values.toList()[index]}'),
            // );
          },
          gridDelegate:
          SliverGridDelegateWithFixedCrossAxisCount(
            childAspectRatio: 2,
            crossAxisSpacing: 10,
            mainAxisSpacing: 10,
            crossAxisCount: 2,
          ),
        ),
      ),
    );
  }
}
